package com.kashi.service.impl;

import com.kashi.mapper.SearchMapper;
import com.kashi.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SearchServiceImpl implements SearchService {

    @Autowired
    private SearchMapper searchMapper;

    @Override
    public void saveHistory(Integer id, String keyword) {
        List<String> newList = searchMapper.read(id);
        newList.add(keyword);
        searchMapper.save(id,newList);
    }

    @Override
    public List<String> readHistory(Integer id) {
        return searchMapper.read(id);
    }
}
